package com.dsjy.yf.address.security.utils;


import com.dsjy.yf.address.config.base.BizException;
import com.dsjy.yf.address.config.base.CommonEnum;
import com.dsjy.yf.address.security.common.api.CommonResult;

/**
 * @author whj
 * @version 1.0
 * @date 2021-03-05 17:27
 */
public class CommonResultUtil {

    public static <T> CommonResult<T> success(T data) {
        return new CommonResult<>(CommonEnum.SUCCESS, data);
    }

    public static CommonResult<String> error(CommonEnum resultEnum, String data) {
        return new CommonResult<>(resultEnum, data);
    }

    public static CommonResult<Object> error(BizException e) {
        return new CommonResult<>(e.getErrorCode(), e.getErrorMsg());
    }

}
